
public class admin {

	private String adminId = null;
	private String adminName = null;
	
	private self self1 = null;
	
	public admin(){
		self1 = new self();
	}
	
	public boolean checkAvailability(String bookName){
		boolean availability = false;
		for(int i=0;i<self1.getBooksCount();i++){
			if(self1.getBooks()[i].getBookName().equalsIgnoreCase(bookName)){
				availability = true;
				break;
			}
		}
		return availability;
	}
	
	public int addBookToSelf(String bookName){
		int bookLocation = 0;
		bookLocation = self1.getBooksCount();
		book java = new book();
		java.setBookName(bookName);
		self1.getBooks()[bookLocation] = java;
		self1.setBooksCount(bookLocation+1);
		return bookLocation;
	}

	public int removeBookFromSelf(String bookName){
		int bookLocation = -1;
		
		for(int i=0;i<self1.getBooksCount();i++){
			if(self1.getBooks()[i].getBookName().equalsIgnoreCase(bookName)){
				bookLocation = i;
				for(int j=i;j<self1.getBooksCount()-1;j++){
					self1.getBooks()[j] = self1.getBooks()[j+1];
				}
				self1.setBooksCount(self1.getBooksCount()-1);
				break;
				
			}
		}
		return bookLocation;

	}
}